package com.finance.swagger;


import com.finance.interceptor.LoginInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author: Apollo
 * @Date: 2021/4/13
 * @Description: 配置拦截器
 */
//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    LoginInterceptor loginInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截器
        InterceptorRegistration interceptorRegistration = registry.addInterceptor(loginInterceptor);
        //需要拦截的路径
        interceptorRegistration.addPathPatterns("/**");
        //需要放过的路径
        interceptorRegistration.excludePathPatterns("/","/BorrowerInfo/index","/BorrowerInfo/login","/BorrowerInfo/register","/borrower-info/register","/borrower-info/login","/borrower-info/sendMessage");
    }

}
